package me.helllp.book.performance.ch03;

public class ExitHook {
	public static void main(String[] args) {
	    // 注册关闭钩子  
	    Runtime.getRuntime().addShutdownHook(new MyShutdownHook());  
	      
	    System.out.println("Start App");  
	    System.exit(0);          // 异常情况，程序直接退出  
	    System.out.println("End App");  
	}
	
	private static class MyShutdownHook extends Thread{
		@Override
		public void run() {
			System.out.println("进行清理工作！"); 
		}
	}
}
